<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN" style="overflow-x:hidden;">
	<head>
		<%@include file="/template/basic.jspf"%>
	</head>
	<body>	
		<form id="form" name="form" class="form-horizontal" method="post">
		<div class="wrap">
		    <div class="row-fluid panel panel-default">
		      <!-- 如果父类状态是0则认为该级别是公司 -->
		      <c:if test="${parent_dept.dept_type==0 }">
					<ul class="nav nav-tabs">
						<li role="presentation" class="active"><a href="#dept_info"
							data-toggle="tab">基础信息</a></li>
						<li role="presentation"><a href="#phone_setting"
							data-toggle="tab">话务信息</a></li>
					</ul>
				</c:if>
				 <div class="panel-body tab-content">
		            <div class="row-fluid tab-pane fade in active" id="dept_info">
		                <div class="form-horizontal">
							<div class="form-group">
							    <label id="lbDeptName" class="col-xs-2 control-label">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</label>
							    <div class="col-xs-8">
							        <input id="txtDeptName" maxlength="20" type="text" class="form-control" name="sysDepFormMap.dept_name" value="${dept.dept_name }" required-message="名称不能为空" check-type="required"/>
							        <input type="hidden"  id="dept_id" name="sysDepFormMap.dept_id" value="${dept.dept_id }"/>
							    </div>
							</div>
							<div class="form-group">
							    <label id="lbDeptName" class="col-xs-2 control-label">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>
							    <div class="col-xs-8">
							    <c:if test="${empty dept.dept_code  }">
							    	<input id="txtDeptCode" maxlength="20" type="text" class="form-control" name="sysDepFormMap.dept_code" value="${dept.dept_code }"  required-message="编码不能为空" check-type="required"/>
									<!-- 如果为新增则把父类path加入 -->
									<input type="hidden"  name="sysDepFormMap.path" value="${parent_dept.path }"/>
								</c:if>
								
								 <c:if test="${!empty dept.dept_code  }">
							    	<input id="txtDeptCode" maxlength="20" type="text" class="form-control" name="sysDepFormMap.dept_code" value="${dept.dept_code }"  required-message="编码不能为空" check-type="required" disabled="disabled"/>
								    <input id="txtDeptCode"  type="hidden"  name="sysDepFormMap.dept_code" value="${dept.dept_code }"  />
									
								</c:if>
								
								
								</div>
							</div>
		                    <div class="form-group">
								<label class="col-xs-2 control-label">类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型</label>
								<div class="col-xs-8">
									<input id="txtParentDeptName" maxlength="20" type="text"
										class="form-control" readonly="readonly"
										value="${parent_dept.dept_type==0?'公司':'部门'}"> <input
										id="txtParentDeptName" maxlength="20" type="hidden"
										class="form-control" name="sysDepFormMap.dept_type"
										value="${parent_dept.dept_type==0?1:2}">
								</div>
							</div>
		                    <div class="form-group">
								<label id="lbDeptName" class="col-xs-2 control-label">上级部门</label>
								<div class="col-xs-8">
									<input id="txtParentDeptName" maxlength="20" type="text"
										class="form-control" value="${parent_dept.dept_name}"
										readonly="readonly" /> <input type="hidden"
										value="${parent_dept.dept_id}" name="sysDepFormMap.parent_id">
								</div>
							</div>
							<div class="form-group">
								<label id="lbSequence" class="col-xs-2 control-label">排&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;序</label>
								<div class="col-xs-8">
									<input id="txtSequence" maxlength="4" type="text"
										class="form-control" name="sysDepFormMap.sequence" value="${dept.sequence }" required-message="排序需要数值型" check-type="required number"/>
								</div>
							</div>
		                    <div class="form-group">
		                        <label id="lbStatus" class="col-xs-2 control-label">状&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;态</label>
		                        <div class="col-xs-8">
		                            <select id="dllStatus" class="form-control"  name="sysDepFormMap.dept_state">
		                                <option value="0" <c:if test="${dept.dept_state==0 }">selected="selected"</c:if>>启用</option>
		                                <option value="1" <c:if test="${dept.dept_state==1 }">selected="selected"</c:if>>禁用</option>
		                            </select>
		                        </div>
		                    </div>
		                    <div class="form-group">
		                        <label id="lbDescription" class="col-xs-2 control-label">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述</label>
		                        <div class="col-xs-8">
		                            <textarea id="txtDescription" class="form-control" maxlength="100" rows="1" name="sysDepFormMap.description" >${dept.description }</textarea>
	                            </div>
		                    </div>
		                </div>
		            </div>
		            <!-- 加载话务中心配置信息 -->
		            <c:if test="${parent_dept.dept_type==0 }">
						<div class="row-fluid tab-pane fade" id="phone_setting">
							<div class="form-horizontal">
								<label id="lbDeptName" class="col-xs-2 control-label">话务平台</label>
								<div class="col-xs-8">
									<select id="settingSelect" class="form-control"
										name="setting_id">
										<option value="">请选择</option>
										<c:forEach var="setting" items="${phoneSettings }">
											<c:if test="${deptPhone.setting_id eq setting.setting_id }">
												<option value="${setting.setting_id }" selected="selected">${setting.setting_name }</option>
											</c:if>
											<c:if test="${!(deptPhone.setting_id eq setting.setting_id) }">
												<option value="${setting.setting_id }">${setting.setting_name }</option>
											</c:if>
										</c:forEach>
									</select>
								</div>
							</div>
						</div>
					</c:if>
		        </div>
		    </div>
		</div>	
		</form>
		<script src="${ctx}/js/system/dept/info.js" type="text/javascript"></script>
	</body>
</html>